#define _CRT_SECURE_NO_WARNINGS 1
#include <stdio.h>
#include <stdlib.h>
int findMaxConsecutiveOnes(int* nums, int numsSize) 
{
    int count = 0;
    int max = 0;
    for (int i = 0; i < numsSize; i++)
    {
        if (nums[i] == 1)
        {
            count++;
        }
        else
        {
            max = max > count ? max : count;
            count = 0;
        }
    }
    max = max > count ? max : count;
    return max;
}

int main()
{
    int len = 0;
    int i = 0;
    scanf("%d", &len);
    int* arr = (int*)malloc(sizeof(int) * len);
    for (i = 0; i < len; i++)
    {
        scanf("%d", &arr[i]);
    }
    int ret = findMaxConsecutiveOnes(arr,len);
    printf("%d ",ret);
    return 0;
}